<template>
  <div>
      <table border="1" cellspacing="0" align="center">
          <tr>
              <th>id</th>
              <th>名字</th>
          </tr>
          <tr v-for="data in datas" :key="data.id">
              <td> {{data.id}} </td>
              <td> {{data.name}} </td>
          </tr>
      </table>
      <button @click="add()">添加</button>
  </div>
</template>

<script>
export default {
    name:'aaa',
    data(){
        return{
            datas:[]
        }
    },
    methods:{
        fn(){
            this.$axios.get('/test').then(res=>{
                this.datas = res.data.list
            })
        },
        add(){
            this.$axios.get('/add').then(res=>{
                this.datas = res.data.list
            })
        }
    },
    mounted(){
        this.fn()
    }
    
}
</script>

<style>

</style>